import {_decorator, director, Sprite} from 'cc';

import {SceneEnum, TriggerStatusEnum, TriggerTypeEnum} from "db://assets/Scripts/Enum";
import {TriggerManager} from './TriggerManager';
import DataManager from "db://assets/Scripts/Runtime/DataManager";

const {ccclass, property} = _decorator;


@ccclass('DoorTriggerManager')
export class DoorTriggerManager extends TriggerManager {
    type: TriggerTypeEnum = TriggerTypeEnum.Door

    render() {
        super.render()
        this.getComponent(Sprite).enabled = DataManager.Instance.doorStatus === TriggerStatusEnum.Pending
    }

    handleTrigger() {
        if (DataManager.Instance.doorStatus === TriggerStatusEnum.Pending) {
            // director.loadScene(SceneEnum.H2A)
            DataManager.Instance.curScene = SceneEnum.H2A
        } else {
            // director.loadScene(SceneEnum.H3)
            DataManager.Instance.curScene = SceneEnum.H3
        }
    }
}